﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default_edit.aspx.cs" Inherits="EM.admin.Users.default_edit" %>

<%@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="radI" %>
<%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>
<%@ Register Assembly="RadTabStrip.Net2" Namespace="Telerik.WebControls" TagPrefix="radTS" %>
<%@ Register Src="~/Common/PageName.ascx" TagName="PageName" TagPrefix="uc1" %>
<%@ Register Src="~/Common/SectionName.ascx" TagName="SectionName" TagPrefix="uc3" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link  runat="server" id="linkCss" rel="stylesheet" href="~/css/master.css" type="text/css"/>
    <link  runat="server" id="linkcssbuttons" rel="stylesheet" href="~/css/buttons.css" type="text/css"/>
     <script src="../../js/PopUp.js" language="javascript"></script>
</head>
 
<body>
    <form id="form1" runat="server">
        <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
                <td class="TdMainContent" valign="top">
                    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td class="TdPageName" colspan="2"><uc1:PageName id="ucPageName" PAGEID="8" PAGEWIDTH="850" runat="server"></uc1:PageName></td>
                        </tr>
                        <tr>
                            <td id="TdMainLeft" class="TdMainLeft" valign="top" style="width:150px">
                                <div id="ContentLeft">
                                    <div class="RightTabDivHeader"><asp:Label ID="lblUsers" runat="server"></asp:Label></div>
                                    <radTS:RadTabStrip ID="rtsCreateUser" runat="server" MultiPageID="rmpCreateUser"  Orientation="VerticalLeftToRight" SelectedIndex="0" Skin="masterTab" CausesValidation="false" >
                                      <Tabs>
                                        <radTS:Tab ID="tabGeneralInfo" PageViewID="pvGeneralInfo" Text="Genel Bilgiler" ></radTS:Tab> 
                                        <radTS:Tab ID="tabRoles" PageViewID="pvRoles" Text="Roller"></radTS:Tab> 
                                      </Tabs>
                                    </radTS:RadTabStrip>
                                </div>
                            </td>
                            <td id="TdMainRight" valign="top" style="float:left;width:100%"  >
                                <div id="ContentRight">
                                    <radTS:RadMultiPage ID="rmpCreateUser" runat="server" SelectedIndex="0">
                                    <radTS:PageView ID="pvGeneralInfo" runat="server" >
                                        <div id="GrdDivMaster">
                                            <table class="MasterEditTable" cellpadding="0" cellspacing="0" border="0">    
	                                            <tr>
	                                                <td class="EditTableLable_Td">Ad Soyad:</td>
	                                                <td><asp:TextBox ID="txtUSERDESC" runat="server" CssClass="EditInputRq" Width="200px"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="rfvUSERDESC" ValidationGroup="vgUser" runat="server" ControlToValidate="txtUSERDESC" ErrorMessage="Kullanıcı adı giriniz" Display="none"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
	                                            <tr>
                                                    <td class="EditTableLable_Td">Kullanıcı Adı:</td>
                                                       <asp:HiddenField ID="hfUserCode" runat="server" />
	                                                <td><asp:TextBox ID="txtUSERCODE" runat="server" CssClass="EditInputRq" Width="200px"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="rfvUSERCODE" runat="server" ValidationGroup="vgUser" ControlToValidate="txtUSERCODE" ErrorMessage="Kullanıcı kodu giriniz" Display="none"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
	                                                <td class="EditTableLable_Td">Şifre:</td>
	                                                <td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password" CssClass="EditinputRq" Width="200"></asp:TextBox>
                                                         <asp:RequiredFieldValidator ID="rfvpass" ValidationGroup="vgUser" runat="server" Display="None" ErrorMessage="Lütfen Şifreyi giriniz"  ControlToValidate="txtPassword"></asp:RequiredFieldValidator>
                                                        <asp:RegularExpressionValidator ID="revPassword" ValidationGroup="vgUser"  runat="server"  ControlToValidate="txtPassword" Display="None"  ErrorMessage="Şifre a-z A-Z 0-9 .-_@ "  validationexpression="^([a-zA-ZçığöşüÇİĞÖŞÜ0-9]*[.\-_@]*)*"> </asp:RegularExpressionValidator>
                                                        <asp:RegularExpressionValidator ID="revPassword2" ValidationGroup="vgUser"  runat="server"  ControlToValidate="txtPassword" Display="None" ErrorMessage="Şifre En az 6 karekter olmalı" validationexpression=".{6}.*"></asp:RegularExpressionValidator>
                                                    </td>
                                                </tr>
                                                <tr>
	                                                <td class="EditTableLable_Td">Şifre(Tekrar):</td>
	                                                <td><asp:TextBox ID="txtPassRepeat" TextMode="Password" runat="server" CssClass="EditInputRq" Width="200px"></asp:TextBox>
                                                          <asp:RequiredFieldValidator ID="rfvPassRepeat" runat="server" ValidationGroup="vgUser"  ControlToValidate="txtPassRepeat" Display="None" ErrorMessage="Lütfen şifre(tekar) giriniz"></asp:RequiredFieldValidator>
                                                          <asp:RegularExpressionValidator ID="revPassRepeat" ValidationGroup="vgUser" Display="None" ErrorMessage="Şifre(tekrar) a-z A-Z 0-9 .-_@ "  runat="server"  ControlToValidate="txtPassRepeat" validationexpression="^([a-zA-ZçığöşüÇİĞÖŞÜ0-9]*[.\-_@]*)*"> </asp:RegularExpressionValidator>
                                                    </td>
                                                </tr>
                                                 <tr>
                                                    <td class="EditTableLable_Td" >Durum</td>
	                                                <td><asp:DropDownList ID="ddlStatus" runat="server" CssClass="editinputrq" Width="200px" onchange="javascript:togglePASSIVEDESC(this);"></asp:DropDownList>
	                                                    <asp:RequiredFieldValidator ID="rfvStatus" runat="server" ControlToValidate="ddlStatus" ValidationGroup="vgUser"  Display="None" ErrorMessage="Kullanıcı durumunu seçiniz" ></asp:RequiredFieldValidator>
	                                                </td>
	                                            </tr>
                                                <tr>
                                                    <td class="EditTableLable_Td">Başlangıç Tarihi:</td>
                                                    <td><radCln:RadDatePicker ID="rdpSTARTDATE"  runat="server" DateInput-DateFormat="dd.MM.yyyy" MaxDate="01/01/2049" MinDate="01/01/2000" Width="95">
                                                       <DateInput skin="masterRq"></DateInput>
                                                       </radCln:RadDatePicker>
                                                       <asp:RequiredFieldValidator ID="rfvSTARTDATE" runat="server" ControlToValidate="rdpSTARTDATE" Display="None" InitialValue="2000-01-01" ErrorMessage="Başlangıç tarihi seçiniz" ></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="EditTableLable_Td">Bitiş Tarihi:</td>
                                                    <td><radCln:RadDatePicker ID="rdpENDDATE"  runat="server" DateInput-DateFormat="dd.MM.yyyy" MaxDate="01/01/2049" MinDate="01/01/2000" Width="95">
                                                       <DateInput Skin="master"></DateInput>
                                                       </radCln:RadDatePicker>
                                                    </td>
                                                </tr>
		                                        <tr>
                                                    <td class="EditTableLable_Td">E-Mail Adresi:</td>
                                                    <td><asp:TextBox ID="txtUSEREMAIL" ValidationGroup="vgUser" runat="server" CssClass="EditInputRq" Width="200px"></asp:TextBox>
                                                        <asp:RegularExpressionValidator ID="revUSEREMAIL" ValidationGroup="vgUser" runat="server" ControlToValidate="txtUSEREMAIL" ErrorMessage="Geçersiz E-mail adresi" Display="none" validationexpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                                                        <asp:RequiredFieldValidator ID="rfvUSEREMAIL"  ControlToValidate="txtUSEREMAIL" runat="server" ErrorMessage="E-mail adresi giriniz" Display="none"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="EditTableLable_Td">Gsm:</td>
                                                    <td><radI:RadMaskedTextBox ID="rtxtUSERGSM" runat="server"  Skin="master" DisplayMask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" Width="200px"
                                                        DisplayPromptChar=" " HideOnBlur="true" Mask="(###) ###-##-##" ></radI:RadMaskedTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="EditTableLable_Td">Tel1:</td>
                                                    <td><radI:RadMaskedTextBox ID="rtxtUSERTEL1" runat="server" DisplayMask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" Width="200px" 
                                                        DisplayPromptChar=" " HideOnBlur="true" Mask="(###) ###-##-##"  Skin="master"></radI:RadMaskedTextBox>
                                                    </td>
                                                </tr>
                                                <tr>    
                                                    <td class="EditTableLable_Td">Tel2:</td>
                                                    <td><radI:RadMaskedTextBox ID="rtxtUSERTEL2" runat="server" DisplayMask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" Width="200px"
                                                            DisplayPromptChar=" " HideOnBlur="true" Mask="(###) ###-##-##"  Skin="master"></radI:RadMaskedTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
	                                                <td class="EditTableLable_Td" valign="top">Pasif yapma sebebi</td>
		                                            <td><asp:TextBox runat="server" ID="rtxtPASSIVEDESC" TextMode="MultiLine" Rows="3" Width="200px" Enabled="false" ></asp:TextBox></td>
	                                            </tr>
	                                            <tr>
	                                                <td class="EditTableLable_Td" >Aynı anda açılabilecek oturum kullanıcı grubundaki gibi </td>
                                                    <td><asp:CheckBox ID="chkMAXCONCURRENTCONNECTIONCOUNT" runat="server" onclick="javascript:toggleMAXCONCURRENTCONNECTIONCOUNT(this);" /></td>
	                                            </tr>
	                                            <tr>
		                                            <td class="EditTableLable_Td">Aynı anda açabileceği maksimum oturum sayısı:</td>
                                                    <td ><asp:TextBox ID="txtMAXCONCURRENTCONNECTIONCOUNT" runat="server" style="text-align:right" CssClass="Editinput" MaxLength="4" Width="40px"></asp:TextBox>
                                                        <asp:CompareValidator ID="cvMAXCONCURRENTCONNECTIONCOUNT"  ValidationGroup="vgUser"  runat="server" ControlToValidate="txtMAXCONCURRENTCONNECTIONCOUNT"
                                                        ErrorMessage="Sayı giriniz" Operator="DataTypeCheck" Type="Integer" Width="108px" Display="none"></asp:CompareValidator>
                                                        <asp:RequiredFieldValidator ID="rfvMAXCONCURRENTCONNECTIONCOUNT"  ValidationGroup="vgUser"  runat="server" ControlToValidate="txtMAXCONCURRENTCONNECTIONCOUNT" ErrorMessage="Aynı anda açabileceği maksimum oturum sayısını giriniz." Display="none"></asp:RequiredFieldValidator>
                                                    </td>
	                                            </tr>
                                            </table>
                                            
                                            <div style="width:750px">
                                                <asp:ValidationSummary ID="vs" runat="server" DisplayMode="BulletList" Width="0px" ValidationGroup="vgUser"  ShowSummary="false" ShowMessageBox="true" />
                                                <table style="float:right">
                                                    <tr>
                                                        <td>
                                                            <asp:LinkButton ID="btnSave" style="float:right" ValidationGroup="vgUser"  CssClass="btn_left xp_ok"    runat="server" OnClick="btnSave_Click"
                                                              OnClientClick="var pass=document.getElementById('txtPassword').value;
                                                               var passagain=document.getElementById('txtPassRepeat').value;
                                                               if(pass!=passagain)
                                                               {alert('Şifre and Şifre(tekrar) aynı olmak zorunda'); return false;} "
                                                            >
                                                                   <strong class="btn_rigth_xp xp">Kaydet</strong>
                                                            </asp:LinkButton>    
                                                        </td>
                                                        <td>
                                                            <a id="btnClose" style="float:right" class="btn_left xp_cancel" runat="server" onclick="javascript:window.close()">
                                                                <strong class="btn_rigth_xp xp">Kapat</strong>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>        
                                        </div>
                                    </radTS:PageView>
                                    <radTS:PageView ID="pvRoles" runat="server"> 
                                        <radcln:RadCalendar ID="sharedCalendar" runat="server" EnableMultiSelect="false" RangeMinDate="01/01/2000" ></radcln:RadCalendar>
                                        <uc3:SectionName id="SectionName1" PAGESECTIONID="9" PAGEWIDTH="507" runat="server"></uc3:SectionName>
                                            <asp:Repeater ID="rptRoles" runat="server" OnItemDataBound="rptRoles_ItemdDataBound" OnItemCommand="rptRoles_ItemCommand">
                                                <HeaderTemplate>
                                                    <table cellpadding="0" cellspacing="0" class="Repeater_Table">
                                                        <tr style="font-weight:bold;background-color:#99ccff">
                                                            <td class="Repeater_Table_Header">Rol</td>
                                                            <td class="Repeater_Table_Header">Başlangıç Tarihi</td>
                                                            <td class="Repeater_Table_Header">Bitiş Tarihi</td>
                                                            <td class="Repeater_Table_Header" width="100px" align="center">İşlemler</td>
                                                        </tr>
                                                        <tr>
                                                            <td class="Repeater_Table_ItemLeft">
                                                                <asp:DropDownList ID="ddlRole" runat="server" CssClass="EditselectRq" Width="155px"></asp:DropDownList> 
                                                                <asp:RequiredFieldValidator ID="rfvRole" ValidationGroup="vg1" runat="server" ControlToValidate="ddlRole" InitialValue="0" Display="None" ErrorMessage="Lütfen rol seçiniz" ></asp:RequiredFieldValidator>
                                                            </td>
                                                            <td  class="Repeater_Table_Item">
                                                                <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleStartdate" MinDate="01/01/2000" runat="server" Width="95">
                                                                    <DateInput skin="masterRQ"></DateInput>
                                                                </radCln:RadDatePicker>
                                                                <asp:RequiredFieldValidator ID="rfvRoleStartdate"  ValidationGroup="vg1" InitialValue="2000-01-01"  runat="server" ControlToValidate="rdpRoleStartdate" Display="None" ErrorMessage="Lütfen başlangıç tarihi seçiniz" ></asp:RequiredFieldValidator>
                                                            </td>
                                                            <td class="Repeater_Table_Item">
                                                                <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleEndDate" MinDate="01/01/2000" runat="server" Width="95" >
                                                                    <DateInput Skin="master"></DateInput>
                                                                </radCln:RadDatePicker>
                                                            </td>
                                                            <td  class="Repeater_Table_Item" align="center">
                                                                <asp:ValidationSummary ID="vs" runat="server" DisplayMode="BulletList"  ValidationGroup="vg1" Width="0px" ShowSummary="false" ShowMessageBox="true" />
                                                                <asp:LinkButton ID="btnAdd" runat="server"  ValidationGroup="vg1" CommandName="Insert" >Ekle</asp:LinkButton>
                                                            </td>
                                                        </tr>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <tr>
                                                        <td class="Repeater_Table_ItemLeft">
                                                            <asp:HiddenField ID="hfROLEID" runat="server" Value='<%#Eval("ROLEID") %>' />
                                                            <asp:DropDownList ID="ddlRole" runat="server" CssClass="EditselectRq" Width="155px"></asp:DropDownList> 
                                                                
                                                            <asp:RequiredFieldValidator ID="rfvRole" runat="server" ControlToValidate="ddlRole" InitialValue="0" Display="None" ErrorMessage="Lütfen rol seçiniz"></asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="Repeater_Table_Item">
                                                            <asp:HiddenField ID="hfSTARTDATE" runat="server" Value='<%#Eval("STARTDATE") %>' />
                                                            <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleStartdate" MinDate="01/01/2000" Width="95" runat="server" >
                                                                <DateInput skin="masterRQ"></DateInput>
                                                            </radCln:RadDatePicker>
                                                            <asp:RequiredFieldValidator ID="rfvRoleStartdate" InitialValue="2000-01-01" runat="server" ControlToValidate="rdpRoleStartdate" Display="None" ErrorMessage="Lütfen başlangıç tarihi seçiniz"></asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="Repeater_Table_Item">
                                                            <asp:HiddenField ID="hfENDDATE" runat="server" Value='<%#Eval("ENDDATE") %>' />
                                                            <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleEndDate" MinDate="01/01/2000" Width="95" runat="server" >
                                                                <DateInput Skin="master"></DateInput>
                                                            </radCln:RadDatePicker>
                                                        </td>
                                                        <td class="Repeater_Table_Item" align="center">
                                                            <asp:ValidationSummary ID="vs" runat="server" DisplayMode="BulletList"  Width="0px" ShowSummary="false" ShowMessageBox="true" />
                                                            <asp:LinkButton ID="btnUpdate" runat="server"  CommandName="Update" CommandArgument='<%#Eval("USERROLEID") %>' >Güncelle</asp:LinkButton>
                                                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" CommandArgument='<%#Eval("USERROLEID") %>' CausesValidation="false">Sil</asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </ItemTemplate>
                                                <AlternatingItemTemplate>
                                                    <tr>
                                                        <td class="Repeater_Table_ItemLeft_Alternating">
                                                            <asp:HiddenField ID="hfROLEID" runat="server" Value='<%#Eval("ROLEID") %>' />
                                                            <asp:DropDownList ID="ddlRole" runat="server" CssClass="EditselectRq" Width="155px"></asp:DropDownList> 
                                                                
                                                            <asp:RequiredFieldValidator ID="rfvRole" runat="server" ControlToValidate="ddlRole" InitialValue="0" Display="None" ErrorMessage="Lütfen rol seçiniz" ></asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="Repeater_Table_Item_Alternating">
                                                            <asp:HiddenField ID="hfSTARTDATE" runat="server" Value='<%#Eval("STARTDATE") %>' />
                                                            <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleStartdate" MinDate="01/01/2000" Width="95" runat="server" >
                                                                <DateInput skin="masterRQ"></DateInput>
                                                            </radCln:RadDatePicker>
                                                            <asp:RequiredFieldValidator ID="rfvRoleStartdate" InitialValue="2000-01-01"  runat="server" ControlToValidate="rdpRoleStartdate" Display="None" ErrorMessage="Lütfen başlangıç tarihi seçiniz" ></asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="Repeater_Table_Item_Alternating">
                                                            <asp:HiddenField ID="hfENDDATE" runat="server" Value='<%#Eval("ENDDATE") %>' />
                                                            <radCln:RadDatePicker DateInput-DateFormat="dd.MM.yyyy" ID="rdpRoleEndDate" MinDate="01/01/2000" Width="95" runat="server" >
                                                                <DateInput Skin="master"></DateInput>
                                                            </radCln:RadDatePicker>
                                                        </td>
                                                        <td class="Repeater_Table_Item_Alternating" align="center">
                                                            <asp:ValidationSummary ID="vs" runat="server" DisplayMode="BulletList"  Width="0px" ShowSummary="false" ShowMessageBox="true" />
                                                            <asp:LinkButton ID="btnUpdate" runat="server"  CommandName="Update" CommandArgument='<%#Eval("USERROLEID") %>' >Güncelle</asp:LinkButton>
                                                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" CommandArgument='<%#Eval("USERROLEID") %>' CausesValidation="false">Sil</asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </AlternatingItemTemplate>
                                                <FooterTemplate>
                                                    </table>
                                                </FooterTemplate>
                                            </asp:Repeater>
                                            <br />
                                           <div style="width:507px;" >
                                            <a id="A2" class="btn_left xp_cancel" href="javascript:window.close();">
                                                <strong class="btn_rigth_xp xp">Kapat</strong>
                                            </a>
                                        </div>
                                    </radTS:PageView>
                                </radTS:RadMultiPage>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
    
    <script type="text/javascript">
function toggleMAXCONCURRENTCONNECTIONCOUNT(obj){
    
    var txtMAXCONCURRENTCONNECTIONCOUNT = document.getElementById("<%=txtMAXCONCURRENTCONNECTIONCOUNT.ClientID %>");   

    if (obj.checked){
           txtMAXCONCURRENTCONNECTIONCOUNT.disabled = true;
          ValidatorEnable(rfvMAXCONCURRENTCONNECTIONCOUNT, false); 
    }
    else{
        txtMAXCONCURRENTCONNECTIONCOUNT.disabled = false;
    }
}

function togglePASSIVEDESC(obj){
    
    var txtPASSIVEDESC = document.getElementById("<%=rtxtPASSIVEDESC.ClientID %>");   
    txtPASSIVEDESC.disabled = obj.value == 'A';
}
</script>      
    
</body>
</html>
